Get Access Permissions to Module

I want to write a script (to be run from Administrator account) that will go through a project and return the access permissions to every module in the database. EG:

/Project1/ModuleA/ Group1=RMCDA
/Project1/ModuleA/ Group2=RMCDA
/Project1/ModuleA/ Person1=R
/Project1/ModuleA/ Person2=RMCD
/Project1/ModuleA/ Everyone Else=None
/Project1/ModuleB/ Group1=RMCDA
/Project1/ModuleB/ Everyone Else=None

There will be some smarts to flag any modules that aren't complying with our specific requirements such as "Everyone Else = RMCDA".

I'm not sure of the dxl that can do the equivalent of:
 

for accessRight in module do {
    print accessRight.username "="
    print accessRight.access "\n"
}

 


DOORS can get the access info without opening the module. I would like to avoid opening the module as well to speed up the process. Does anyone know how to do this?

 


Peter.Dawson - Mon Dec 14 00:18:14 EST 2009

Re: Get Access Permissions to Module
ManuelFelger - Mon Dec 14 08:30:57 EST 2009

Hey Peter,

I've needed a similar overview a few month ago and wrote this script. I hope its useful to you.

And yes, you dont need to open the modules to get informations about permissions, you do this with the AccessRec get() function, you can find the documentation in the DXL Reference Manual.

Regards,
Manuel
Attachments

attachment_14417027_Project_Overview_projects.dxl

Re: Get Access Permissions to Module
llandale - Mon Dec 14 17:25:33 EST 2009

ManuelFelger - Mon Dec 14 08:30:57 EST 2009
Hey Peter,

I've needed a similar overview a few month ago and wrote this script. I hope its useful to you.

And yes, you dont need to open the modules to get informations about permissions, you do this with the AccessRec get() function, you can find the documentation in the DXL Reference Manual.

Regards,
Manuel

Don't have to open the module ... since DOORS v8.3??

Re: Get Access Permissions to Module
Peter.Dawson - Mon Dec 14 18:46:31 EST 2009

ManuelFelger - Mon Dec 14 08:30:57 EST 2009
Hey Peter,

I've needed a similar overview a few month ago and wrote this script. I hope its useful to you.

And yes, you dont need to open the modules to get informations about permissions, you do this with the AccessRec get() function, you can find the documentation in the DXL Reference Manual.

Regards,
Manuel

Thanks alot. I'll take a look at the script.

One more thing. Can the AccessRec function also be used to return the access rights for modifying an Attribute Definition as well as access rights to Attribute Values.

It looks like I will need to report this information as well.

Cheers
Peter

Re: Get Access Permissions to Module
ePiallat - Tue Dec 15 04:35:14 EST 2009

llandale - Mon Dec 14 17:25:33 EST 2009
Don't have to open the module ... since DOORS v8.3??

Hi Louis,
You don't have to open the Module since DOORS v8.0, as you can access the Attribute definition through the "ModuleProperties" object.
But I must confess I never was lucky using it (segmentation faults each time I tried to loop through folders).

Re: Get Access Permissions to Module
ePiallat - Tue Dec 15 04:36:46 EST 2009

Peter.Dawson - Mon Dec 14 18:46:31 EST 2009
Thanks alot. I'll take a look at the script.

One more thing. Can the AccessRec function also be used to return the access rights for modifying an Attribute Definition as well as access rights to Attribute Values.

It looks like I will need to report this information as well.

Cheers
Peter

Hi, You may find this usefull too:

Permission permission (AccessRec ar) {
  Permission returned = none
  if read(ar)    then returned = returned | read
  if modify(ar)  then returned = returned | modify
  if create(ar)  then returned = returned | create
  if delete(ar)  then returned = returned | delete
  if control(ar) then returned = returned | control
  return returned
}
 
string stringOf (Permission p){
  string returned = ""
  if (p & read    == read   ) returned = returned "R"
  if (p & modify  == modify ) returned = returned "M"
  if (p & create  == create ) returned = returned "C"
  if (p & delete  == delete ) returned = returned "D"
  if (p & control == control) returned = returned "A"
  if (returned    == ""     ) returned = "none"
  return returned
}


- Éric

Re: Get Access Permissions to Module
Peter.Dawson - Tue Dec 15 18:39:35 EST 2009

ManuelFelger - Mon Dec 14 08:30:57 EST 2009
Hey Peter,

I've needed a similar overview a few month ago and wrote this script. I hope its useful to you.

And yes, you dont need to open the modules to get informations about permissions, you do this with the AccessRec get() function, you can find the documentation in the DXL Reference Manual.

Regards,
Manuel

Thanks all, Manuel's original post answers my question.

The step that was eluding me was where you have to compare the AccessRec object to every user and group in the list.

This part:

for g in groupList do
{
    string groupName = g.name
    string errMsg
    AccessRec ar = get(p, groupName, errMsg)
    if (null ar) {}
    elseif (control ar)
    //.....etc
}

Re: Get Access Permissions to Module
SR-ITC - Thu Sep 15 08:38:28 EDT 2011

ManuelFelger - Mon Dec 14 08:30:57 EST 2009
Hey Peter,

I've needed a similar overview a few month ago and wrote this script. I hope its useful to you.

And yes, you dont need to open the modules to get informations about permissions, you do this with the AccessRec get() function, you can find the documentation in the DXL Reference Manual.

Regards,
Manuel

the dxl posted only shows permissions for the module groups, not individual users. What is the dxl to get the user name with RMCDA or whatever it has for a module in the list? The dxl code displayed in the forum gave me an error. I'm running 9.1

Re: Get Access Permissions to Module
llandale - Thu Sep 15 15:01:17 EDT 2011

SR-ITC - Thu Sep 15 08:38:28 EDT 2011
the dxl posted only shows permissions for the module groups, not individual users. What is the dxl to get the user name with RMCDA or whatever it has for a module in the list? The dxl code displayed in the forum gave me an error. I'm running 9.1

Does this answer the question?

AccessRec ar
string    NameAccess
for ar in mod do
{  NameAccess    = username(ar)       // My code surrounds this with noError/lastError, but don't recall why.
   if (isDefault(ar))
   {} // Everyone else
   if NameAccess == getAdministratorName())
   {}  // v7x bug where the Admin got access records (at least for Views)
   elseif(existsGroup(NameGroup)
   {  Group grp = find(NameAccess)  // Deal with Group access
   }
   elseif(existsUser(NameAccess)
   {  User usr = find(NameAccess)
   }
   else
   {}  // out of possibilities, I think.
}

Re: Get Access Permissions to Module
llandale - Thu Sep 15 15:02:47 EDT 2011

llandale - Thu Sep 15 15:01:17 EDT 2011

Does this answer the question?

AccessRec ar
string    NameAccess
for ar in mod do
{  NameAccess    = username(ar)       // My code surrounds this with noError/lastError, but don't recall why.
   if (isDefault(ar))
   {} // Everyone else
   if NameAccess == getAdministratorName())
   {}  // v7x bug where the Admin got access records (at least for Views)
   elseif(existsGroup(NameGroup)
   {  Group grp = find(NameAccess)  // Deal with Group access
   }
   elseif(existsUser(NameAccess)
   {  User usr = find(NameAccess)
   }
   else
   {}  // out of possibilities, I think.
}

elseif NameAccess == getAdministratorName())